<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:mo="https://gitee.com/aun/Timo1"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<body>

<div class="layui-card">

    <div class="layui-card-header">
        <span class="layui-icon font-s10 color-desc margin-right-5"></span>服务权限管理
        <div class="pull-right">
<!--            <button data-table-id="NoticeTable" class="layui-btn layui-btn-primary  layui-btn-sm" data-modal="/system/user/form" data-height="720px" data-width="800px">-->
<!--                <i class=" layui-icon layui-icon-addition"></i>新建护工</button>-->
        </div>
    </div>

    <div class="layui-card-line"></div>

    <div class="layui-card-body">

        <div class="layui-card-table layui-tab">
            <div class="layui-tab-content">
                <form th:replace="/pcs/porter_permission/index_examine_search">

                </form>
                <table id="PorterPermissionExamineTable" data-url="/pcs/porter/permission/examine" data-target-search="form.form-search"></table>
                <script th:inline="javascript">
                    var verifyStatus = [[${verifyStatus}]]
                </script>
                <script type="text/javascript" th:inline="none">
                    $(function () {
                        $('#PorterPermissionExamineTable').layTable({
                            even: true, height: 'full',where:{verifyStatus:verifyStatus,orderBy:"verifyStatus:asc,id:desc"},
                            cols: [[
                                {checkbox: true, fixed: true, width: 60},
                                {title: '序号', type: 'numbers', width: 80},
                                {field: 'companyName', title: '陪护公司', minWidth: 180, align: 'center'},
                                {field: 'porterName', title: '陪护员姓名', minWidth: 180, align: 'center'},
                                {field: 'sex', title: '性别', align: 'center', templet: function (d) {
                                    if (d.sex == 1) {
                                        return '男';
                                    } else if (d.sex == 2) {
                                        return '女';
                                    } else {
                                        return '未知';
                                    }
                                }},
                                {field: 'age', title: '年龄', align: 'center'},
                                {field: 'phone', title: '手机号', align: 'center', minWidth: 110},
                                {field: 'depName', title: '护理科室权限', align: 'center'},
                                {field: 'verifyStatus', title: '审核状态', align: 'center', templet: function (d) {
                                    if (d.verifyStatus == 0) {
                                        return '<span class="layui-font-blue">待审核</span>';
                                    } else if (d.verifyStatus == 1) {
                                        return '<span class="layui-font-green">已授权</span>';
                                    } else if (d.verifyStatus == 2) {
                                        return '<span class="layui-font-red">已驳回</span>';
                                    } else if (d.verifyStatus == 3) {
                                       return '<span class="layui-font-gray">已取消</span>';
                                    } else {
                                        return '未知';
                                    }
                                }},
                                {field: 'canalStatus', title: '取消审核状态', align: 'center', templet: function (d) {
                                        if (d.canalStatus == 0) {
                                            return '<span class="layui-font-gray">正常</span>';
                                        } else if (d.canalStatus == 1) {
                                            return '<span class="layui-font-blue">审核中</span>';
                                        } else if (d.canalStatus == 2) {
                                            return '<span class="layui-font-green">已通过</span>';
                                        } else if (d.canalStatus == 3) {
                                            return '<span class="layui-font-red">已驳回('+d.canalBRemark+')</span>';
                                        } else {
                                            return '未知';
                                        }
                                    }},
                                {field: 'createTime', title: '申请时间', align: 'center', minWidth: 180},
                                {toolbar: '#toolbar', title: '操作', align: 'center', minWidth: 180, fixed: 'right'}
                            ]]
                        });
                    });



                </script>



                <script type="text/html" id="toolbar">
                    {{# if(d.verifyStatus == 0){ }}
                    <a class="layui-btn layui-btn-sm" data-event-dbclick   data-action='/pcs/porter/permission/verify?ids={{d.id}}&verifyStatus=1'>授权</a>
                    <a class="layui-btn layui-btn-sm layui-btn-danger" data-event-dbclick   data-modal='/pcs/porter/permission/canal?id={{d.id}}&verifyStatus=2'>驳回</a>
                    {{# }else if(d.verifyStatus == 1 && d.canalStatus == 0){ }}

                    <a class="layui-btn layui-btn-sm layui-bg-gray" data-event-dbclick   data-modal='/pcs/porter/permission/canal?id={{d.id}}&verifyStatus=3'>取消授权</a>
                    {{# }else if(d.verifyStatus == 2){ }}
                    <a class="layui-btn layui-btn-sm layui-bg-gray" >已驳回授权</a>
                    {{# }else if(d.verifyStatus == 3){ }}
                    <a class="layui-btn layui-btn-sm layui-bg-gray" >已取消</a>
                    {{# } }}

                </script>

            </div>
        </div>
    </div>

</div>
</body>
</html>